﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DocumentFormat.OpenXml.Lite.Shared
{
    public delegate void ListEventHandler<T>(object sender, ListEventArgs<T> args);

    public enum ListEventType
    {
        Add, Insert, Remove
    }

    public class ListEventArgs<T> : EventArgs
    {
        public bool Canceled { get; set; }
        public ListEventType Type { get; set; }
        public IEnumerable<T> Objects { get; set; }

        public ListEventArgs(T obj, ListEventType type)
        {
            this.Type = type;
            this.Canceled = false;
            this.Objects = new T[] { obj };
        }

        public ListEventArgs(IEnumerable<T> objects, ListEventType type)
        {
            this.Type = type;
            this.Canceled = false;
            this.Objects = objects;
        }
    }
}
